CREATE TABLE [dbo].[tb_TiposDeInsumos]
(
[idTipoDeInsumo] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER [dbo].[updateTipoInsunmos] ON [dbo].[tb_TiposDeInsumos] 
FOR UPDATE
AS
if (update(idTipoDeInsumo)) begin
	UPDATE tb_Insumos
	SET TipoDeInsumo = (SELECT idTipoDeInsumo from inserted)
	WHERE TipoDeInsumo in (SELECT idTipoDeInsumo from deleted)
end
GO
ALTER TABLE [dbo].[tb_TiposDeInsumos] ADD CONSTRAINT [PK_tb_TiposDeInsumos] PRIMARY KEY NONCLUSTERED  ([idTipoDeInsumo]) ON [PRIMARY]
GO
